package vista;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.text.ParseException;

import javax.swing.BorderFactory;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
import javax.swing.border.BevelBorder;
import javax.swing.border.LineBorder;
import javax.swing.border.SoftBevelBorder;

import bean.BtSacfre;
import bean.TablaPlus;
import bean.TxtEscribirSoloNumeros;
import controlador.ControladorConsultarDeudaCliente;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class frmConsultarDeudaCliente extends javax.swing.JFrame {
	private JPanel pndatos;
	private JPanel pnconsulta;
	private JLabel lblidentificacion;
	private JComboBox cmbidentificacion;
	private JLabel lblapellido;
	private TxtEscribirSoloNumeros txtnumero;
	private JLabel lblnombre;
	private JLabel lblnombre2;
	private JLabel lblapellido2;
	private JLabel lblcuenta;
	private BtSacfre btbuscar;
	private JTabbedPane tabpanel;
	private BtSacfre btimprimir;
	private JSeparator separadorventa;
	private JLabel lbldetallegestion;
	private TablaPlus tbcuentas;
	private JLabel lbltotal;
	private JLabel lblmonto;
	private TablaPlus tbventas;
	private TablaPlus tbcompra;
	private TablaPlus tbpago;
	private BtSacfre btpagar;
	private BtSacfre btcancelar;
	private BtSacfre btverdetalle;
	private JOptionPane mensaje;
	private ControladorConsultarDeudaCliente controlador;
	
	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				frmConsultarDeudaCliente inst = new frmConsultarDeudaCliente();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public frmConsultarDeudaCliente(ControladorConsultarDeudaCliente controlador) {
		super();
		this.controlador = controlador;
		initGUI();
	}
	public frmConsultarDeudaCliente() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			this.setTitle("SACFRE/Consulta de Deuda del Cliente");
			this.setResizable(false);
			{
				pndatos = new JPanel();
				getContentPane().add(pndatos, BorderLayout.CENTER);
				pndatos.setLayout(null);
				pndatos.setBackground(new java.awt.Color(239,171,183));
				pndatos.setPreferredSize(new java.awt.Dimension(1267, 560));
				{
					pnconsulta = new JPanel();
					pndatos.add(pnconsulta);
					pnconsulta.setBounds(12, 12, 1243, 472);
					pnconsulta.setLayout(null);
					pnconsulta.setBackground(new java.awt.Color(255,219,225));
					pnconsulta.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, new java.awt.Color(0,0,0)));
					{
						lblnombre = new JLabel();
						pnconsulta.add(lblnombre);
						lblnombre.setText("Nombres:");
						lblnombre.setBounds(439, 21, 89, 15);
						lblnombre.setFont(new java.awt.Font("FreeSerif",1,16));
					}
					{
						lblidentificacion = new JLabel();
						pnconsulta.add(lblidentificacion);
						lblidentificacion.setText("Identificacion:");
						lblidentificacion.setBounds(14, 22, 113, 15);
						lblidentificacion.setFont(new java.awt.Font("FreeSerif",1,16));
					}
					{
						lbldetallegestion = new JLabel();
						pnconsulta.add(lbldetallegestion);
						lbldetallegestion.setText("Relacion de Deuda");
						lbldetallegestion.setBounds(5, 57, 236, 15);
						lbldetallegestion.setFont(new java.awt.Font("FreeSerif",1,16));
					}
					{
						ComboBoxModel cmbidentificacionModel = 
							new DefaultComboBoxModel(
									new String[] { "V-", "J-", "E-" });
						cmbidentificacion = new JComboBox();
						pnconsulta.add(cmbidentificacion);
						cmbidentificacion.setModel(cmbidentificacionModel);
						cmbidentificacion.setBounds(126, 13, 44, 30);
						cmbidentificacion.setBackground(new java.awt.Color(247,218,223));
					}
					{
						txtnumero = new TxtEscribirSoloNumeros();
						pnconsulta.add(txtnumero);
						txtnumero.setBounds(174, 10, 218, 35);
					}
					{
						btbuscar = new BtSacfre();
						pnconsulta.add(btbuscar);
						btbuscar.setBounds(398, 11, 30, 33);
						btbuscar.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Iconos/search_business_user.png")));
					}
					{
						lblnombre2 = new JLabel();
						pnconsulta.add(lblnombre2);
						lblnombre2.setBounds(526, 10, 299, 35);
						lblnombre2.setBorder(new LineBorder(new java.awt.Color(0,0,0), 1, false));
						lblnombre2.setFont(new java.awt.Font("FreeSerif",1,16));
					}
					{
						lblapellido = new JLabel();
						pnconsulta.add(lblapellido);
						lblapellido.setText("Apellidos:");
						lblapellido.setBounds(837, 21, 89, 15);
						lblapellido.setFont(new java.awt.Font("FreeSerif",1,16));
					}
					{
						lblapellido2 = new JLabel();
						pnconsulta.add(lblapellido2);
						lblapellido2.setBounds(926, 10, 299, 35);
						lblapellido2.setBorder(new LineBorder(new java.awt.Color(0,0,0), 1, false));
						lblapellido2.setFont(new java.awt.Font("FreeSerif",1,16));
					}
					{
						separadorventa = new JSeparator();
						pnconsulta.add(separadorventa);
						separadorventa.setBounds(5, 74, 1231, 2);
						separadorventa.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null));
					}
					{
						lblcuenta = new JLabel();
						pnconsulta.add(lblcuenta);
						lblcuenta.setText("Cuentas.");
						lblcuenta.setBounds(170, 94, 77, 25);
						lblcuenta.setFont(new java.awt.Font("FreeSerif",1,16));
					}
					{
						String[] columnas = { "id","Cuenta" , "Total(bsf)" };
						tbcuentas = new TablaPlus();
						tbcuentas.setBounds(33, 119, 334, 290);
						pnconsulta.add(tbcuentas);
						tbcuentas.setTablaPlus(columnas);
						tbcuentas.setBorder(new LineBorder(new java.awt.Color(0,0,0), 1, false));
						tbcuentas.setEnabled(false);
						tbcuentas.setFont(new java.awt.Font("FreeSerif",1,14));
					}
					{
						tabpanel = new JTabbedPane();
						pnconsulta.add(tabpanel);
						tabpanel.setBounds(387, 94, 797, 315);
						tabpanel.setBackground(new java.awt.Color(255,255,255));
					}

					{
						lbltotal = new JLabel();
						pnconsulta.add(lbltotal);
						lbltotal.setText("Total a Pagar:");
						lbltotal.setFont(new java.awt.Font("FreeSerif",1,36));
						lbltotal.setBounds(33, 415, 265, 46);
					}
					{
						lblmonto = new JLabel();
						pnconsulta.add(lblmonto);
						lblmonto.setText("0.0 Bsf");
						lblmonto.setFont(new java.awt.Font("FreeSerif",1,36));
						lblmonto.setBounds(304, 421, 322, 34);
					}
					{
						btverdetalle = new BtSacfre();
						pnconsulta.add(btverdetalle);
						btverdetalle.setBounds(1036, 414, 148, 45);
						btverdetalle.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Iconos/search_page.png")));
						btverdetalle.setBorderPainted(false);
						btverdetalle.setText("Ver Detalle");
						btverdetalle.setFont(new java.awt.Font("FreeSerif",1,16));
					}
					{
						btpagar = new BtSacfre();
						pnconsulta.add(btpagar);
						btpagar.setText("Pagar");
						btpagar.setBounds(1061, 477, 169, 76);
						btpagar.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Iconos/accept.png")));
					}
			        {
			        	JPanel tabC = new JPanel();
			        	tabpanel.addTab("Pagos", null, tabC, null);
			        	tabC.setLayout( new BorderLayout() );
			        	tabC.setPreferredSize( new Dimension(100,100) );
			        	{
							String[] columnas = {"Fecha", "Num. Pago","Concepto", "Monto(bsf)" };
							tbpago = new TablaPlus();
							tbpago.setBounds(410, 119, 797, 290);
							tabC.add(tbpago);
							tbpago.setTablaPlus(columnas);
							tbpago.setBorder(new LineBorder(new java.awt.Color(0,0,0), 1, false));
							tbpago.setFont(new java.awt.Font("FreeSerif",1,14));
							tbpago.setEnabled(false);
						}
			        }
			        {
			        	JPanel tabB = new JPanel();
			        	tabpanel.addTab("Ventas", null, tabB, null);
			        	tabB.setLayout( new BorderLayout() );
			        	tabB.setPreferredSize(new java.awt.Dimension(733, 263));
			        	{
			        		String[] columnas = { "Fecha", "Num. de Venta", "Total(bsf)" };
			        		tbventas = new TablaPlus();
			        		tabB.add(tbventas, BorderLayout.CENTER);
			        		tbventas.setBounds(410, 119, 797, 290);
			        		tbventas.setTablaPlus(columnas);
			        		tbventas.setBorder(new LineBorder(new java.awt.Color(0,0,0), 1, false));
			        		tbventas.setEnabled(false);
			        		tbventas.setFont(new java.awt.Font("FreeSerif",1,14));
			        		tbventas.setPreferredSize(new java.awt.Dimension(725, 228));
			        	}
			        }
			        {
			        	JPanel tabA = new JPanel();
			        	tabpanel.addTab("Compras", null, tabA, null);
			        	tabA.setPreferredSize( new Dimension(100,100) );
			        	tabA.setLayout(new BorderLayout());
			        	{
							String[] columnas = { "Fecha", "Num. de Compra ", "Tipo de Compra","Total(bsf)" };
							tbcompra = new TablaPlus();
							tbcompra.setBounds(410, 119, 797, 290);
							tabA.add(tbcompra);
							tbcompra.setTablaPlus(columnas);
							tbcompra.setEnabled(false);
							tbcompra.setBorder(new LineBorder(new java.awt.Color(0,0,0), 1, false));
							tbcompra.setFont(new java.awt.Font("FreeSerif",1,14));
						}
			        }
			        {
						btcancelar = new BtSacfre();
						pndatos.add(btcancelar);
						btcancelar.setBounds(911, 490, 169, 58);
						btcancelar.setText("Cancelar");
						btcancelar.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Iconos/delete.png")));
					}
			        {
						btpagar = new BtSacfre();
						pndatos.add(btpagar);
						btpagar.setText("Pagar");
						btpagar.setBounds(1086, 490, 169, 58);
						btpagar.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Iconos/accept.png")));
					}
			        {
			        	btimprimir = new BtSacfre();
			        	pndatos.add(btimprimir);
			        	btimprimir.setText("Exportar");
			        	btimprimir.setBounds(742, 490, 164, 58);
			        	btimprimir.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Iconos/pdf.png")));
			        }
				}
			}
			pack();
			this.setSize(1275, 592);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	
	public void Agregar_Escuchadores(ActionListener accion){
		this.btbuscar.addActionListener(accion);
		this.btcancelar.addActionListener(accion);
		this.btpagar.addActionListener(accion);
		this.btverdetalle.addActionListener(accion);
		this.btimprimir.addActionListener(accion);
		this.tbcuentas.getTabla().addMouseListener(new MouseAdapter() {
    		public void mouseClicked(MouseEvent evt) {
    			try {
					controlador.jTable1MouseClicked(evt);
				} catch (ParseException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
    		}
    	});
		//this.tbcuentas.getTabla().setModel(
		
	}

	public JPanel getPndatos() {
		return pndatos;
	}

	public JPanel getPnconsulta() {
		return pnconsulta;
	}

	public JLabel getLblidentificacion() {
		return lblidentificacion;
	}

	public JComboBox getCmbidentificacion() {
		return cmbidentificacion;
	}

	public JLabel getLblapellido() {
		return lblapellido;
	}

	public TxtEscribirSoloNumeros getTxtnumero() {
		return txtnumero;
	}

	public JLabel getLblnombre() {
		return lblnombre;
	}

	public JLabel getLblnombre2() {
		return lblnombre2;
	}

	public JLabel getLblapellido2() {
		return lblapellido2;
	}

	public JLabel getLblcuenta() {
		return lblcuenta;
	}

	public BtSacfre getBtbuscar() {
		return btbuscar;
	}

	public JTabbedPane getTabpanel() {
		return tabpanel;
	}

	public JSeparator getSeparadorventa() {
		return separadorventa;
	}

	public JLabel getLbldetallegestion() {
		return lbldetallegestion;
	}

	public TablaPlus getTbcuentas() {
		return tbcuentas;
	}

	public JLabel getLbltotal() {
		return lbltotal;
	}

	public JLabel getLblmonto() {
		return lblmonto;
	}

	public TablaPlus getTbventas() {
		return tbventas;
	}

	public TablaPlus getTbcompra() {
		return tbcompra;
	}

	public TablaPlus getTbpago() {
		return tbpago;
	}

	public BtSacfre getBtpagar() {
		return btpagar;
	}

	public BtSacfre getBtcancelar() {
		return btcancelar;
	}

	public BtSacfre getBtverdetalle() {
		return btverdetalle;
	}

	public JOptionPane getMensaje() {
		return mensaje;
	}

	public BtSacfre getBtimprimir() {
		return btimprimir;
	}
}
